<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
	<title></title>
</head>
<body>

</body>
<script type="text/javascript">
	var str = "abcdefgaddda";
	var obj = {};
	for (var i = 0, l = str.length; i < l; i++) {
	   var key = str[i];
	   if (!obj[key]) {
	      obj[key] = 1;
	   } else {
	      obj[key]++;
	   }
	}

	/*遍历，获取value最大的key和value*/

	var max = -1;
	var max_key = "";
	var key;
	for (key in obj) {
	   if (max < obj[key]) {
	      max = obj[key];
	      max_key = key;
	   }
	}
	alert("max:"+max+" max_key:"+max_key);
</script>
</html>